package com.lanyou.cook.entity.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.lanyou.cook.common.DefaultDateJsonSerializer;
import com.lanyou.cook.entity.kettle.KettleSlaveServer;
import com.lanyou.cook.entitylistener.domain.InterfaceSettingServiceEntityListenerForLog;

@Entity
@EntityListeners({ AuditingEntityListener.class,InterfaceSettingServiceEntityListenerForLog.class})
@Table(name = "T_COOK_BU_RUN_SERVICE_SET")
public class InterfaceScheduleServer {

	@Id
	@GeneratedValue(generator = "uuidGenerator")
	@GenericGenerator(name = "uuidGenerator", strategy = "uuid")
	@Column(name = "RUN_SERVICE_SET_ID", length = 36)
	private String id;
	
	@Version
	@JsonIgnore
	private int version;

	@Column(name = "RUN_WAY", length = DataDictionaryValue.MAX_LENGTH_OF_CODE)
	private String runWay;

	@CreatedBy
	@Column(length = 50, updatable = false)
	private String creator;

	@LastModifiedBy
	@Column(length = 50)
	private String modifier;

	@Column(name = "CREATED_DATE", updatable = false)
	@JsonSerialize(using = DefaultDateJsonSerializer.class)
	@CreatedDate
	private Date createTime;

	@Column(name = "LAST_UPDATED_DATE")
	@JsonSerialize(using = DefaultDateJsonSerializer.class)
	@LastModifiedDate
	private Date modifyTime;

	@ManyToOne(optional = true)
	@JoinColumn(name = "R_SLAVE_ID")
	private KettleSlaveServer slaveServer;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getRunWay() {
		return runWay;
	}

	public void setRunWay(String runWay) {
		this.runWay = runWay;
	}

	public KettleSlaveServer getSlaveServer() {
		return slaveServer;
	}

	public void setSlaveServer(KettleSlaveServer slaveServer) {
		this.slaveServer = slaveServer;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public String getModifier() {
		return modifier;
	}

	public void setModifier(String modifier) {
		this.modifier = modifier;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}

}
